package com.wavehi.web.homework.forth;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author WaveHi
 * @Date 17/9/2021 下午 8:58
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description
 */
@WebServlet("/rangeOfInnerObjectDemoServlet01")
public class RangeOfInnerObjectDemoServlet01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //设置域对象的数据
        req.setAttribute("user", "Tom");
        req.getSession().setAttribute("age", "23");
        getServletContext().setAttribute("email", "qwpfif@163.com");
        //获取请求对象
        RequestDispatcher dis = req.getRequestDispatcher("rangeOfInnerObjectDemoServlet02");
        //请求转发
        dis.forward(req, resp);
    }
}
